<template>
	<view :style="themeColor">
		<view class="page">
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-center benben-flex-layout loginPage_flex_0">
				<image class='loginPage_fd0_0' mode="aspectFit" :src='STATIC_URL+"142.png"'></image>
				<text class='loginPage_fd0_1'>鑫林商学院</text>
			</view>

			<!---flex布局flex布局结束-->
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout loginPage_flex_1">
				<view class='flex flex-wrap align-center loginPage_fd1_0'>
					<image class='loginPage_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"138.png"'></image>
					<benben-input class='flex-sub loginPage_fd1_0_c1' type="number" :placeholder="`请输入手机号`"
						confirm-type="done" :maxlength="11" placeholder-style="color:#999;font-size:32rpx"
						v-model="account" />
				</view>
				<view class='flex flex-wrap align-center loginPage_fd1_1'>
					<image class='loginPage_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"139.png"'></image>
					<benben-flex-password-diy v-model="password" class-name="flex align-center flex loginPage_fd1_1_c1"
						:placeholder="'请输入密码(6~12位字母+数字)'" :maxlength="12" :default-type='true'
						placeholder-style="color:#999;font-size:32rpx">
						<template #show>
							<!-- <text class='fu-iconfont2  loginPage_fd1_1_c1_icon1' data-type="show">&#xe693;</text> -->
							<image style="width: 48rpx;height: 48rpx;" data-type="show" :src='STATIC_URL+"1.png"' mode=""></image>
						</template>
						<template #hide>
							<!-- <text class='fu-iconfont2  loginPage_fd1_1_c1_icon2' data-type="hide">&#xEBCC;</text> -->
							<image style="width: 48rpx;height: 48rpx;" data-type="hide" :src='STATIC_URL+"2.png"' mode=""></image>
						</template>
					</benben-flex-password-diy>
				</view>
				<button class='loginPage_fd1_2' @tap.stop="onlogonFunc()">登录</button>
				<view class='flex flex-wrap align-center justify-center loginPage_fd1_3'>
					<text class='loginPage_fd1_3_c0' @tap.stop="handleJumpDiy" data-type="navigateTo"
						:data-url="`/pages/dlzc/forgotPasswordPage/forgotPasswordPage`">忘记密码</text>
				</view>
				<view class='flex flex-wrap align-center justify-center loginPage_fd1_4'>
					<benben-flex-switch-new class-name='flex flex' v-model="id_tk" :disabled='false'>
						<template v-slot:checked>

							<view class='flex flex position-relative align-center'>
								<image class='loginPage_checkfd1_4_c0_c0_c0' mode="aspectFit"
									:src='STATIC_URL+"140.png"'></image>
							</view>

						</template>
						<template v-slot:unchecked>

							<view class='flex flex position-relative justify-end align-center'>
								<image class='loginPage_noCheckfd1_4_c0_c1_c0' mode="aspectFit"
									:src='STATIC_URL+"141.png"'></image>
							</view>

						</template>
					</benben-flex-switch-new>
					<text class='loginPage_fd1_4_c1'>已阅读并同意</text>
					<text class='loginPage_fd1_4_c2' @tap.stop="handleJumpDiy" data-type="navigateTo"
						:data-url="`/pages/dlzc/agreements/agreements?type=1`">《用户注册协议》</text>
					<text class='loginPage_fd1_4_c3'>与</text>
					<text class='loginPage_fd1_4_c2' @tap.stop="handleJumpDiy" data-type="navigateTo"
						:data-url="`/pages/dlzc/agreements/agreements?type=2`">《隐私政策》</text>
				</view>
			</view>

			<!---flex布局flex布局结束-->
			<!---flex布局flex布局开始-->
			<!-- <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout loginPage_flex_2">
				<view class='flex flex-wrap align-center justify-center loginPage_fd2_0'>

					<view class='flex  loginPage_fd2_0_c0'></view>

					<text class='loginPage_fd2_0_c1'>快捷登录</text>

					<view class='flex  loginPage_fd2_0_c0'></view>

				</view>
				<view class='flex flex-wrap align-center justify-center loginPage_fd2_1'>
					<image class='loginPage_fd2_1_c0' mode="aspectFit" :src='STATIC_URL+"67.png"'></image>
				</view>
			</view> -->

			<!---flex布局flex布局结束-->


		</view>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"account": "",
				"password": "",
				"dataList": {
					"userinfo": {
						"user_token": "",
						"id": "",
						"avatar": "",
						"real_name": "",
						"nickname": "",
						"email": "",
						"gender": "",
						"mobile": "",
						"birthday": "",
						"client_id": "",
						"phone": ""
					}
				},
				"id_tk": false,
				"is_submit": false,
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {

		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//登录
			async onlogonFunc() {
				if (this.is_submit) return;
				if (!validate(this.account, 'require')) {
					this.$message.info('请输入手机号');
					return false;
				}
				if (!validate(this.account, 'phone')) {
					this.$message.info('请输入正确的手机号');
					return false;
				}
				if (!validate(this.password, 'require')) {
					this.$message.info('请输入密码');
					return false;
				}
				if (!validate(this.password, 'password')) {
					this.$message.info('请输入正确的密码(6~12位字母+数字)');
					return false;
				}
				if (this.id_tk === false) {
					this.$message.info('请阅读并同意用户注册协议和隐私政策');
					return false;
				}
				//请求方法
				//数据验证
				this.is_submit = true;
				let datadataList = await this.$api.post(global.apiUrls.post5c78dbfd977cf, {
					account: this.account,
					account_type: 'mobile',
					password: this.password
				});
				
				if (datadataList.data.code != 1) {
					this.is_submit = false;
					this.$message.info(datadataList.data.msg);
					return
				}
				let infodataList = datadataList.data;
				this.dataList = infodataList.data

				this.$store.commit('saveToken', this.dataList.userinfo.user_token)
				this.$store.commit('updateUserInfo', this.dataList.userinfo)
				this.$message.info(datadataList.data.msg);
				setTimeout(() => {
					this.is_submit = false;
					this.$urouter.switchTab(`/pages/tabBar/home/home`);
				}, 800)
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: url(image-path('137.png')) no-repeat;
		background-size: 100% auto;
	}

	.loginPage_flex_0 {
		padding: 185rpx 0rpx 0rpx 0rpx;
	}

	.loginPage_fd0_1 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 45rpx;
		margin: 38rpx 0rpx 40rpx 0rpx;
	}

	.loginPage_fd0_0 {
		width: 160rpx;
		height: 160rpx;
		border-radius: 33rpx 33rpx 33rpx 33rpx;
	}

	.loginPage_flex_1 {
		padding: 0rpx 56rpx 0rpx 56rpx;
	}

	.loginPage_fd1_4_c3 {
		color: var(--benbenFontColor2);
		font-size: 28rpx;
		font-weight: 400;
		line-height: 33rpx;
	}

	.loginPage_fd1_4_c2 {
		color: rgba(67, 154, 236, 1);
		font-size: 28rpx;
		font-weight: 400;
		line-height: 33rpx;
	}

	.loginPage_fd1_4_c1 {
		color: var(--benbenFontColor2);
		font-size: 28rpx;
		font-weight: 400;
		line-height: 33rpx;
		margin: 0rpx 0rpx 0rpx 16rpx;
	}

	.loginPage_noCheckfd1_4_c0_c1_c0 {
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		width: 48rpx;
		height: 48rpx;
	}

	.loginPage_checkfd1_4_c0_c0_c0 {
		width: 48rpx;
		height: 48rpx;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
	}

	.loginPage_fd1_4 {
		background: #f6f7f9;
		position: fixed;
		bottom: calc(0rpx + var(--window-bottom));
		left: 0rpx;
		width: 750rpx;
		background-size: 100% auto;
		height: 100rpx;
		z-index: 9;
	}

	.loginPage_fd1_3_c0 {
		color: var(--benbenFontColor2);
		font-size: 28rpx;
		font-weight: 400;
		line-height: 40rpx;
	}

	.loginPage_fd1_3 {
		margin: 34rpx 0rpx 0rpx 0rpx;
	}

	.loginPage_fd1_2 {
		background: #E60012;
		font-size: 32rpx;
		color: var(--benbenFontColor3);
		width: 640rpx;
		height: 80rpx;
		line-height: 80rpx;
		margin: 100rpx 0rpx 0rpx 0rpx;
		border-radius: 16rpx;
	}

	.loginPage_fd1_1_c1_icon2 {
		width: 88rpx;
		line-height: 88rpx;
		text-align: center;
		font-size: 40rpx;
	}

	.loginPage_fd1_1_c1_icon1 {
		width: 88rpx;
		line-height: 88rpx;
		text-align: center;
		font-size: 32rpx;
		color: rgba(191, 191, 191, 1);
	}

	::v-deep .loginPage_fd1_1_c1 {
		height: 45rpx;
		font-size: 32rpx;
		margin: 0rpx 0rpx 0rpx 32rpx;
		line-height: 40rpx;
		font-weight: 400;
		color: var(--benbenFontColor0);
		width: 550rpx;
	}

	.loginPage_fd1_1 {
		border-bottom: 1px solid rgba(238, 238, 238, 1);
		margin: 0rpx 0rpx 0rpx 0rpx;
		padding: 40rpx 0rpx 40rpx 0rpx;
	}

	.loginPage_fd1_0_c1 {
		color: var(--benbenFontColor0);
		font-size: 32rpx;
		font-weight: 400;
		line-height: 40rpx;
		margin: 0rpx 0rpx 0rpx 32rpx;
		height: 45rpx;
	}

	.loginPage_fd1_0_c0 {
		width: 48rpx;
		height: 48rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.loginPage_fd1_0 {
		border-bottom: 1px solid rgba(238, 238, 238, 1);
		margin: 40rpx 0rpx 0rpx 0rpx;
		padding: 40rpx 0rpx 40rpx 0rpx;
	}

	.loginPage_flex_2 {
		padding: 0rpx 0rpx 100rpx 0rpx;
	}

	.loginPage_fd2_1_c0 {
		width: 80rpx;
		height: 80rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.loginPage_fd2_1 {
		margin: 32rpx 0rpx 0rpx 0rpx;
	}

	.loginPage_fd2_0_c1 {
		color: var(--benbenFontColor2);
		font-size: 26rpx;
		font-weight: 400;
		line-height: 37rpx;
		margin: 0rpx 10rpx 0rpx 10rpx;
	}

	.loginPage_fd2_0_c0 {
		background: #EEEEEE;
		width: 156rpx;
		height: 1rpx;
		margin: 10rpx 0rpx 10rpx 0rpx;
		transform: scaleY(0.5);
		border-radius: 1rpx 1rpx 1rpx 1rpx;
	}

	.loginPage_fd2_0 {
		margin: 120rpx 0rpx 0rpx 0rpx;
	}
</style>